package com.gulimall.search.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Package: com.gulimall.search.comfig
 * Description：ES 配置信息
 * Author: huangjian
 * Date:  2020/6/21 16:45
 * Modified By:
 */
@Configuration
public class ESConfig {
    public static final RequestOptions COMMON_OPTIONS;

    static {
        RequestOptions.Builder builder = RequestOptions.DEFAULT.toBuilder();
        COMMON_OPTIONS = builder.build();
    }

    @Bean
    public RestHighLevelClient restHighLevelClient() {
        RestHighLevelClient client = null;
        RestClientBuilder restClientBuilder = RestClient.builder(new HttpHost("192.168.67.194", 9200, "http"));
        client = new RestHighLevelClient(restClientBuilder);
        return client;
    }
}
